package cn.highedu.demo;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class WorkerDemo {
    public static void main(String[] args) {
        // 创建Spring IOC容器
        AnnotationConfigApplicationContext context =
                new AnnotationConfigApplicationContext(MyConfig.class);
        // 从Spring IOC容器中获取被管理的对象
        Worker worker = context.getBean(Worker.class);
        worker.work();
    }
}
